import{b as e,ut as t,y as n}from"./B603vO-13smUKN.js";import{r,s as i}from"./CvEJN-vi4hXmWG.js";import{vn as a}from"./CIxmKYxc4tZcJF.js";import{a as o}from"./BbxvatETxeTHf.js";var s=t(`tasks`),c=new e({name:`rootProgress`,totalUnits:0,completeUnits:0});function l(t=1){let n=new e({totalUnits:t});return c.addChild(n),n}function u(e){let t=n(e);return c.addChild(t.progress),t}var d=a(``),f=a(0),p=a(0);a(0);var m=a(!1),h=i(()=>{f.value=c.getTotalUnits(),p.value=c.getCompletedUnits(),m.value=f.value!==p.value},{delay:200});c.on(`progressChanged`,h);var g=u({name:`tasks`,maxParallel:5});function _(e,t,n,i){return g.enqueue(async n=>{try{d.value=e??``,e&&r(e),n&&await t(n)}catch(e){s.error(`task error =`,e)}},{payload:n,group:i})}function v(e,t,n){return _(e,t,n,`serial`)}globalThis.isNodeTestEnv||window.addEventListener(`beforeunload`,e=>{if(m.value)return e.preventDefault(),e.returnValue=o(`tasks.beforeUnload`)},{capture:!0});export{c as a,p as c,u as i,d as l,v as n,m as o,l as r,f as s,_ as t};